//
//  AXMyFbCollectionViewCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/18.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXMyFbCollectionViewCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"


@interface AXMyFbCollectionViewCell ()


@end

@implementation AXMyFbCollectionViewCell

- (id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self creatView];
        [self setlayout];
        
        //wangherun666
        self.layer.cornerRadius = 5;
        self.layer.masksToBounds = YES;
        self.layer.borderWidth = 1;
        self.layer.borderColor = COLOR_GREEN.CGColor;
    }
    return self;
}

- (void)creatView {
    
    /** imageview */
    self.storeImageView = [[UIImageView alloc]init];
    self.storeImageView.image = [UIImage imageNamed:@"sg3.jpeg"];
    [self.contentView addSubview:self.storeImageView];
    /** title */
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.text = @"农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术农业种植技术";
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    self.nameLabel.font = FONT_FOURTEEN;;
    [self.contentView addSubview:self.nameLabel];
    /** 用户图像 */
    self.userImageView = [[UIImageView alloc]init];
    self.userImageView.cornerRadius = 15;
    self.userImageView.image = [UIImage imageNamed:@"xy.jpeg"];
    [self.contentView addSubview:self.userImageView];
    /** 用户名字 */
    self.userNameLabel = [[UILabel alloc]init];
    self.userNameLabel.font = FONT_FOURTEEN;;
    self.userNameLabel.text = @"雪花女神龙";
    [self.contentView addSubview:self.userNameLabel];
    
    self.praiseButton = [[UIButton alloc]init];
    [self.praiseButton setImage:[UIImage imageNamed:@"dz"] forState:UIControlStateNormal];
    [self.praiseButton addTarget:self action:@selector(tapPraise:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.praiseButton];
    
}

- (void)setlayout {
    /** 店铺图片 */
    self.storeImageView.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.contentView,0)
    .widthIs((SCREEN_WIDTH-30)/2)
    .heightIs((SCREEN_WIDTH-30)/2-60);
    /** 店铺名字 */
    self.nameLabel.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.storeImageView,0)
    .widthIs((SCREEN_WIDTH-30)/2)
    .heightIs(30);
    /** 用户图像 */
    self.userImageView.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .bottomSpaceToView(self.contentView, 5)
    .widthIs(30)
    .heightIs(30);
    /** 点赞 */
    self.praiseButton.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .centerYEqualToView(self.userImageView)
    .widthIs(15)
    .heightIs(15);
    
    /** 用户名字 */
    self.userNameLabel.sd_layout
    .leftSpaceToView(self.userImageView, 10)
    .centerYEqualToView(self.userImageView)
    .rightSpaceToView(self.praiseButton, 10)
    .heightIs(30);
    
    
    
    
}

- (void)tapPraise:(UIButton *)btn {
    
}

@end
